#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dirent.h>


#define PATHNAME "./2"
int main(){
	DIR * dir_p  = NULL;
	dir_p = opendir( PATHNAME );
	if( !dir_p ){
		printf("dir_p is %d\n" , dir_p);
		return -1;
	}
	
	struct dirent * dirent_p;
	while( dirent_p  = readdir( dir_p ) ){
		printf( "filename is :%s | " ,dirent_p->d_name ) ;
		printf("type is %d\n" , dirent_p->d_type );
	}

	close( dir_p );
}
